package com.lms.thread.demo4;

/**
 * @Author: 李孟帅
 * @CreateTime: 2020-01-19 10:13
 * @Description: ${Description}
 */
public class VolatileTest implements Runnable{
    private  volatile String str="1111";
    @Override
    public void run() {
        System.out.println(str);
        while (true) {
            if (str.equals("222")){
                System.out.println("str:" + str);
            }
        }
    }
    public void setStr(String str){
        this.str=str;
    }

    public String getStr() {
        return str;
    }
}
